<?php

class Com_album{
	
	public $defaultAct='index';
	function __construct($ainfo=null){
	}
	
	function cglist(){
		$cgdata = Afun_cache_get('com_album_cgdata');
		if(empty($cgdata)){
		//获取分类
			$con->select = "a.*,b.image,b.thumb,(SELECT count(*) FROM `a_album_image` where `album_id`=a.id) as count";
			$con->join = "LEFT JOIN `".Acan_table_album_image."` b ON b.id=a.in";
			$con->where = "a.in > 0";
			$rs_albumcg = Afun_db()->model(Acan_table_album_name)->findAll($con);
		//读取用户组信息
			foreach($rs_albumcg as $key=>$row){
				if($row['thumb']==1){
					$row['path_thumb']= Acan_path_album_image."/$row[uid]/$row[id]/".Acan_path_album_thumb."/$row[image]";
				}else{
					$row['path_thumb']= Acan_path_album_image."/$row[uid]/$row[id]/$row[image]";
				}
				$row['path_thumb']=$Asite['pic'].$row['path_thumb'];
				if (!empty($row['count'])){
					$cgdata[] = $row;
				}
			}
			Afun_cache_set('com_album_cgdata',$cgdata,300);//写入缓存
		}
		return $cgdata;
	}
	
	
}

?>